﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LeMigue.TeamPortal.Base.Biz.Interface;
using LeMigue.Framework.Utils;
using LeMigue.TeamPortal.Base.Biz.Implement;

namespace LeMigue.TeamPortal.Base.Biz
{
    public static class FactoryBiz
    {
        //TODO: estudar se existe uma forma de incluir dentro da propria interface uma chamada para este padrão
        private static ICurrentUser _currentUser = null;
        public static ICurrentUser CurrentUser{
            get
            {
                //TODO: incluir em outro local não sei se faria parte da biz mesmo
                if (_currentUser == null)
                    _currentUser = DIUnity.GetInstance<ICurrentUser>("CurrentUser", typeof(CurrentUser));
                return _currentUser;
            }
        }

        private static ITeamBiz _teamBiz = null;
        public static ITeamBiz TeamBiz
        {
            get
            {
                if (_teamBiz == null)
                    _teamBiz = DIUnity.GetInstance<ITeamBiz>("TeamBiz", typeof(TeamBiz));
                return _teamBiz;
            }
        }

        private static IIterationBiz _iterationBiz = null;
        public static IIterationBiz IterationBiz
        {
            get
            {
                if (_iterationBiz == null)
                    _iterationBiz = DIUnity.GetInstance<IIterationBiz>("IterationBiz", typeof(IterationBiz));
                return _iterationBiz;
            }
        }

        private static IProjectBiz _projectBiz = null;
        public static IProjectBiz ProjectBiz
        {
            get
            {
                if (_projectBiz == null)
                    _projectBiz = DIUnity.GetInstance<IProjectBiz>("ProjectBiz", typeof(ProjectBiz));
                return _projectBiz;
            }
        }

        private static IMemberBiz _memberBiz = null;
        public static IMemberBiz MemberBiz
        {
            get
            {
                if (_memberBiz == null)
                    _memberBiz = DIUnity.GetInstance<IMemberBiz>("MemberBiz", typeof(MemberBiz));
                return _memberBiz;
            }
        }

        private static IScrumBoardBiz _scrumBoardBiz = null;
        public static IScrumBoardBiz ScrumBoardBiz
        {
            get
            {
                if (_scrumBoardBiz == null)
                    _scrumBoardBiz = DIUnity.GetInstance<IScrumBoardBiz>("ScrumBoardBiz", typeof(ScrumBoardBiz));
                return _scrumBoardBiz;
            }
        }

        private static ISprintBiz _sprintBiz = null;
        public static ISprintBiz SprintBiz
        {
            get
            {
                if (_sprintBiz == null)
                    _sprintBiz = DIUnity.GetInstance<ISprintBiz>("SprintBiz", typeof(SprintBiz));
                return _sprintBiz;
            }
        }

        private static ITaskBiz _taskBiz = null;
        public static ITaskBiz TaskBiz
        {
            get
            {
                if (_taskBiz == null)
                    _taskBiz = DIUnity.GetInstance<ITaskBiz>("TaskBiz", typeof(TaskBiz));
                return _taskBiz;
            }
        }
    }
}
